package com.atguigu.spzx.controller;

import com.atguigu.spzx.service.SysUserService;
import com.atguigu.spzx.spzx.model.dto.system.LoginDto;
import com.atguigu.spzx.spzx.model.vo.common.Result;
import com.atguigu.spzx.spzx.model.vo.system.LoginVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name="首页控制层")
@RestController
@RequestMapping("/admin/system/index")
@CrossOrigin(allowCredentials = "true",originPatterns = "*",allowedHeaders = "*")
public class SysUserController {

    @Autowired
    SysUserService sysUserService;

    @Operation(summary = "用户登录接口")
    @PostMapping("/login")
    public Result login(@RequestBody LoginDto loginDto){
        LoginVo login = sysUserService.login(loginDto);
        return Result.ok().data(login);
    }

}
